package com.wenx.date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class dateMain {
    public static void main(String[] args) {
        String date = "2018-01-01 00:00:00";
        LocalDateTime dateTime = LocalDateTime.parse(date,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:ss:mm"));
        System.out.println("dateTime = " + dateTime.toString().substring(0,7));
        //System.out.println("dateTime = " + dateTime.getYear()+dateTime.getMonthValue());
        dateTime = dateTime.minusMonths(1L);
        System.out.println("dateTime = " + dateTime.toString().substring(0,7));

    }
}
